<%--
  Created by IntelliJ IDEA.
  User: Roger
  Date: 2020/8/20
  Time: 10:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>index</title>
</head>
<body>
index...
<a href="${pageContext.request.contextPath}/user/simpleParam?id=1&username=杰克"> 基本类型 </a> <br>
<form method="post" action="${pageContext.request.contextPath}/user/pojoParam">
    <input type="text" name="id">
    <input type="text" name="username">
    <input type="submit" value="对象类型">
</form>
<br>
<form action="${pageContext.request.contextPath}/user/arrayParam"> 编号：<br> <input type="checkbox" name="ids" value="1">1<br>
    <input type="checkbox" name="ids" value="2">2<br> <input type="checkbox" name="ids" value="3">3<br> <input
            type="checkbox" name="ids" value="4">4<br> <input type="checkbox" name="ids" value="5">5<br> <input
            type="submit" value="数组类型"></form>
<br>
<form action="${pageContext.request.contextPath}/user/queryParam" method="post"> 搜索关键字： <input type="text"
                                                                                               name="keyword"> <br>
    user对象： <input type="text" name="user.id" placeholder="编号">
    <input type="text" name="user.username" placeholder="姓名"><br> list集合<br> 第一个元素： <input
            type="text" name="userList[0].id" placeholder="编号">
    <input type="text" name="userList[0].username"
           placeholder="姓名"><br> 第二个元素： <input type="text"
                                               name="userList[1].id"
                                               placeholder="编号">
    <input type="text" name="userList[1].username" placeholder="姓名"><br> map集合<br>
    第一个元素：
    <input type="text"
           name="userMap['u1'].id"
           placeholder="编号">
    <input type="text" name="userMap['u1'].username" placeholder="姓名"><br> 第二个元素： <input type="text"
                                                                                         name="userMap['u2'].id"
                                                                                         placeholder="编号"> <input
            type="text" name="userMap['u2'].username" placeholder="姓名"><br> <input type="submit" value="复杂类型"></form>
<form action="${pageContext.request.contextPath}/user/converterParam">
    生日：<input type="text" name="birthday"> <input type="submit" value="自定义类型转换器">
</form>
<br>
<script src="${pageContext.request.contextPath}/js/jquery-3.5.1.js"></script>
<button id="btn1" value="ajax请求">ajax</button>
<script>
    $("#btn1").click(function () {
        let url = "${pageContext.request.contextPath}/user/ajaxRequest";
        // let data = '{"id":1,"username":"张三"}';
        let data = '{"empId":"1","epmName":"dadwqe","deptId":"1","jobTitle":"jingli","joinDate":"0001-01-01","telephone":"12345"}';
        // let data = '{"empId":1,"epmName":"张三","deptId":1,"jobTitle":"早经理""joinDate":"2020/02/02","telephone":123456}';

        $.ajax({
            type: 'POST',
            url: url,
            data: data,
            contentType: 'application/json;charset=utf-8',
            success: function (response) {
                alert(JSON.stringify(response))
            }
        })

    })
</script>

<%--<form method="post" enctype="multipart/form-data" action="${pageContext.request.contextPath}/fileUpload">
    文件名：<input type="text" name="fileName"><br>
    文件：<input type="file" name="filePic">
    <input type="submit" value="上传">
</form>--%>

<form action="${pageContext.request.contextPath}/fileUpload" method="post" enctype="multipart/form-data"> 名称：<input
        type="text" name="username"> <br> 文件：<input type="file" name="filePic"> <br> <input type="submit" value="单文件上传">
</form>
</body>
</html>
